package com.web.base.wechat.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.blue.jdbc.JdbcDataSource;
import com.blue.jdbc.Page;
import com.web.base.wechat.dao.SendTemplateDao;
import com.web.base.wechat.model.SendTemplate;
import com.web.core.util.Const;

@Service("wechatSendTemplateService")
@Transactional
@JdbcDataSource(Const.DS_BASE)
public class SendTemplateService
{
	@Autowired
	private SendTemplateDao sendTemplateDao;
	
	public SendTemplateService()
	{
	}
	
	public void save(SendTemplate template)
	{
		if (template.getId() == null)
		{
			sendTemplateDao.save(template);
		}
		else
		{
			sendTemplateDao.update(template);
		}
	}
	
	public void saveList(List<SendTemplate> list)
	{
		sendTemplateDao.saveList(list);
	}
	
	public SendTemplate get(Long id)
	{
		SendTemplate template = sendTemplateDao.get(id);
		return template;
	}
	
	public Page<SendTemplate> list(SendTemplate template, Page<SendTemplate> page)
	{
		page = sendTemplateDao.list(template, page);
		return page;
	}
	
}
